﻿//----------------------------------------------------------
//搜索
function check() {
    if (document.formr.fkey.value == "请输入关键字..") { document.formr.fkey.focus(); return false; }
    document.formr.submit();
    return true
}

//----------------------------------------------------------
//记住菜单
var lastNav = 0;
var docUrl = document.location.href;
var k = $.sp.getCookie("lastNav");
if (!isNaN(k))
    lastNav = k;
var currentNav = function () {
    $("li", ".nav_list").eq(lastNav).addClass("nav_current1");
    $("li a", ".nav_list").each(function (i) {
        var t = $(this);
        t.hover(function () {
            t.addClass("current");
        }, function () {
            t.removeClass();
        })
        $(this).click(function () {
            $.sp.setCookie("lastNav", i);
            lastNav = i;
        });
    });
}


$(function () {
    //currentNav();
});



//----------------------------------------------------------
//设置banner图片滚动
var banner_frist = 0;
var banner_datetime;
function banner_showpic(banner_frist) {
    var imgheight = $('.slider_tab').width();
    $('.slider_items').stop(true, false).animate({ left: -imgheight * banner_frist }, 400)
    $('.slider_navs a').removeClass('active').eq(banner_frist).addClass('active');
    $('.slider_title div').hide().eq(banner_frist).show();
};
var banner_marquee = function () {
    var banner_size = $('.slider_navs>a').length;
    $('.slider_navs a').mouseover(function () {
        banner_frist = $('.slider_navs a').index(this);
        banner_showpic(banner_frist);
    }).eq(0).mouseover();

    $('.slider_tab').hover(function () {
        clearInterval(banner_datetime);
    }, function () {
        clearInterval(banner_datetime);
        banner_datetime = setInterval(function () {
            banner_showpic(banner_frist);
            banner_frist++;
            if (banner_frist == banner_size) {
                banner_frist = 0;
            }
        }, 3000);
    }).trigger('mouseleave');
};

$(function () {
    banner_marquee();
});

//----------------------------------------------------------
//根据分辩率更改图片大小
var imgWidth = 1200;
var _setWidth = function () {
    imgWidth = $(window).width();
    $('.slider_tab').width(imgWidth);
    $('.slider_tabscroll').width(imgWidth);
    $('.imgbox').width(imgWidth);
    var ml = (1920 - imgWidth) / 2;
    $("img", '.imgbox').css("margin-left", -ml + "px");
}
$(function () {
    //_setWidth();
});
$(window).resize(function () {
    //_setWidth(); 
});


//*  */
//#qqOnlineDiv { position: absolute; z-index: 999; top: 100px; right: 20px; width: 100px; height: auto; background: #fff; border: solid 1px #dadada; }
function showQQ() {
    var winTop = $(window).scrollTop();
    $("#qqOnlineDiv").animate({ top: winTop + 165 }, 300);
};

$(window).scroll(function () {
    //$("#qqOnlineDiv").stop();
    //showQQ();
});
$(function () {
    //showQQ();
});
